#!/bin/bash
#通过人力给的一张表，使用awk和数组统计性别
declare -A sex
while read line
do
type=`echo $line | awk '{print $2}'`
let sex[$type]=sex[$type]+1
done < sex.txt

for i in ${!sex[*]}
do
echo "索引 $i:值是 ${sex[$i]}"
done
